<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>编辑图书</title>
		<link type="text/css" rel="stylesheet" href="/static/css/style.css">
		<style type="text/css">
			h1 {
				text-align: center;
				margin-top: 200px;
			}

			h1 a {
				color: red;
			}

			input {
				text-align: center;
			}
		</style>
	</head>

	<body>
		<div id="header">
			<span class="wel_word">编辑图书</span>
			<div>
				<a href="/refactor/manager/bookManager">图书管理</a>
				<a href="/refactor/manager">返回</a>
			</div>
		</div>

		<div id="main">
			<form action="/refactor/manager/updateOrAddBook" method="POST" enctype="multipart/form-data">
				<table>
					<tr>
						<td>名称</td>
						<td>价格</td>
						<td>作者</td>
						<td>销量</td>
						<td>库存</td>
						<td>图片</td>
						<td colspan="2">操作</td>
					</tr>
					<tr>
						{{if .Data}}
						<input type="hidden" name="bookID" value="{{ .Data.ID }}" />
						<td><input name="title" type="text" value="{{ .Data.Title }}" /></td>
						<td><input name="price" type="text" value="{{ .Data.Price }}" /></td>
						<td><input name="author" type="text" value="{{ .Data.Author }}" /></td>
						<td><input name="sales" type="text" value="{{ .Data.Sales }}" /></td>
						<td><input name="stock" type="text" value="{{ .Data.Stock }}" /></td>
						<input name="imgpath" type="hidden" value="{{ .Data.ImgPath }}" />
						<img class="book_img" name="oldImgPath" alt="" src={{.Data.ImgPath}} />
						<td><input name="newImgPath" type="file" value="请上传图片" /></td>
						{{else}}
						<td><input name="title" type="text" /></td>
						<td><input name="price" type="text" /></td>
						<td><input name="author" type="text" /></td>
						<td><input name="sales" type="text" /></td>
						<td><input name="stock" type="text" /></td>
						<td><input name="newImgPath" type="file" value="请上传图片" /></td>
						{{end}}
						<td><input type="submit" value="提交" /></td>
					</tr>
				</table>
			</form>


		</div>

		<div id="bottom">
			<span>
				书城.Copyright &copy;2020.<a href="http://www.beian.miit.gov.cn/">鄂ICP备20002228号</a>
			</span>
		</div>
	</body>

</html>